package com.example.medicine.Mapper.yian;


import com.example.medicine.Bean.yian.yian_maizhen;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface yian_maizhenMapper {
    @Select("select * from [yian_maizhen]")
    public List<yian_maizhen> getAll();

    @Select("select * from [yian_maizhen] where yianid=#{yianid}")
    public List<yian_maizhen> getByYianId(long yianid);

    @Insert("insert into [yian_maizhen](yianid,name) values(#{yianid},#{name})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    public void insertOne(yian_maizhen yian_maizhen);

    @Insert({
            "<script>",
            "insert into [yian_maizhen](yianid, name) values",
            "<foreach collection='list' item='item' separator=','>",
            "(#{item.yianid}, #{item.name})",
            "</foreach>",
            "</script>"
    })
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    void insertBatch(List<yian_maizhen> yianMaizhenList);

    @Delete("delete from [yian_maizhen] where yianid=#{yianid}")
    public void deleteByYianId(long yianid);
}
